package Month07.day11;

import java.util.ArrayList;

public class tt {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student student3 = new Student("迪丽热巴",12);
        Student student4 = new Student("么人扎实",18);
        Student student5 = new Student("赛道还有",23);
        list.add(student3);
        list.add(student4);
        list.add(student5);
        ArrayList<Object> st=getList(list);
        for (int i = 0; i < st.size(); i++) {
            Student student= (Student) st.get(i);
            int a=student.getAge();
            String ss=student.getName();
            System.out.println(a+ss);
        }
    }
    public static ArrayList<Object> getList(ArrayList<Student> list){
        ArrayList<Object> list1 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            Student stu=list.get(i);
            int age=stu.getAge();
            if (age<18){
                list1.add(stu);
            }
        }
        return list1;
    }
}
